<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加用户</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE1 a{
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
th {
	font-weight:normal;
}
-->
</style>
<script language="javascript">
function checkform(){
	if(form1.username.value=="" ||  form1.email.value==""){
		alert("***项不能为空!");
		return false;
	}

	if(form1.password.value!="" ){
		if(form1.oldpassword.value=="" ){
			alert("修改密码，请填写旧密码！");
			form1.oldpassword.focus();
			return false;
		}		
	}

	if(form1.oldpassword.value!="" ){
		if(form1.password.value=="" ){
			alert("修改密码，新密码不能空！");
			form1.password.focus();
			return false;
		}		
	}
	
	if(!isEmail(form1.email.value)){
		alert("邮件格式不正确!")
		return false;
	}
	return true;
}

function isEmail(strEmail) {
	if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
	else
	return false;
}

function changeTitle(num){
	var obj1 = document.getElementById('change1');
	var obj2 = document.getElementById('change2');
	
	if(num == 1){
		obj1.innerHTML="生产";
		obj2.innerHTML="生产";
	}else{
		obj1.innerHTML="经营";
		obj2.innerHTML="经营";
	}
}

var l=-1;
function AddRow(count){
	 l=l+1;
	 var table=document.getElementById("d_message");
	 var row=table.insertRow();
	 var cell=row.insertCell();
	 cell.parentElement.id=l;

	 cell.innerHTML="<input type=\"text\" name=\"dispatching_name[]\" value=\"\" /><input type=\"text\" name=\"dispatching_area[]\" value=\"\" />";
}

</script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1%" height="19" valign="bottom"><div align="center"><img src="./View/admin/images/tb.gif" width="14" height="14" /></div></td>
                <td width="99%" valign="bottom"><span class="STYLE1">{{$Title}}</span></td>
              </tr>
            </table></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>  
	<form action="admin.php?controller=Admin_User&action=ModifySave" method="post" name="form1" id="form1" onsubmit="return checkform();">
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" class="stripe">
      <tr>
        <th width="20%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">属性名称</span></div></th>
        <th width="80%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="left"></div></th>
        </tr>
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">用户名</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="username" type="text" size="50" value="{{$rowse.username}}" /><font color="#FF0000">***</font></td>
        </tr>
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">新密码</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="newpassword" type="password" size="50"  value="" /></td>
      </tr>
       <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">重复新密码</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="newpassword1" type="password" size="50"  value="" /></td>
      </tr>       
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">电子邮箱</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="email" type="text" size="50"  value="{{$rowse.email}}" /><font color="#FF0000">***</font></td>
      </tr>
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">姓名</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="pname" type="text" size="50"  value="{{$rowse.declareperson.name}}" /><font color="#FF0000">***</font></td>
      </tr>
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">电话</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input name="cellphone" type="text" size="50"  value="{{$rowse.declareperson.cellphone}}" /><font color="#FF0000">***</font></td>
      </tr>
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">具有的权限</span></div></td>
	<td height="20" bgcolor="#FFFFFF" class="STYLE19">
	{{section name=s loop=$rolesList}}
		
		<input type="checkbox" name="ids[]" value="{{$rolesList[s].role_id}}"  
		{{section name=g loop=$rowse.roles}}
			{{if $rowse.roles[g].role_id eq $rolesList[s].role_id}}
			  checked			
			{{/if}}
		{{/section}}
		 />{{$rolesList[s].rolename}}<br />		
	{{/section}}
	</td>
      </tr>
      <tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 企业性质: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><select
					name="nature" size="1"
					onchange="changeTitle(this.options[this.selectedIndex].value)">
					<option value="-1">请选择</option>
					{{section name=cm loop=$companyNature}}
					<option value="{{$companyNature[cm].id}}"
						{{if $company.nature==
						$companyNature[cm].id}}selected="selected"{{/if}}>{{$companyNature[cm].name}}</option>
					{{/section}}
				</select></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 企业名称: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox required" type="text" id="name" name="name"
					value="{{$company.name}}" size="40" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 企业营业执照号: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox required validate-email" type="text"
					id="permitNumber" name="permitNumber"
					value="{{$company.permitNumber}}" size="40" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19">
				企业营业执照号有效期截止日期: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox required validate-email" type="text"
					id="permitValideDate" name="permitValideDate"
					value="{{$company.permitValideDate}}" size="40" />
				格式为“2009-03-24”</td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 医疗器械<span
					id="change1">{{if $company.nature == 1}}生产{{else}}经营{{/if}}</span>许可证号:
				</span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox required validate-email" type="text"
					id="manageNumber" name="manageNumber"
					value="{{$company.manageNumber}}" size="40" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 医疗器械<span
					id="change2">{{if $company.nature == 1}}生产{{else}}经营{{/if}}</span>许可证号有效期截止日期:
				</span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox required validate-email" type="text"
					id="manageValideDate" name="manageValideDate"
					value="{{$company.manageValideDate}}" size="40" />
				格式为“2009-03-24”</td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 公司电话: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text" id="cTelephone"
					name="cTelephone" size="40"
					value="{{$company.cTelephone}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 法人姓名: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text" id="legalPerson"
					name="legalPerson" size="40"
					value="{{$company.legalPerson}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 法人手机: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text"
					id="legalPersonCellphone" name="legalPersonCellphone" size="40"
					value="{{$company.legalPersonCellphone}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 法人座机: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-password" type="text" id="telephone"
					name="telephone" value="{{$company.telephone}}"
					size="40" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 负责人姓名: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text" id="resPerson"
					name="resPerson" size="40"
					value="{{$company.resPerson}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 负责人手机: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text"
					id="resPersonCellphone" name="resPersonCellphone" size="40"
					value="{{$company.resPersonCellphone}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 负责人座机: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-password" type="text"
					id="resPersonTelephone" name="resPersonTelephone"
					value="{{$company.resPersonTelephone}}" size="40" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 联系人/经办人姓名: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text" id="contactPerson"
					name="contactPerson" size="40"
					value="{{$company.contactPerson}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 联系人/经办人手机: </span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text"
					id="contactPersonCellphone" name="contactPersonCellphone" size="40"
					value="{{$company.contactPersonCellphone}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6">
				<div align="center"><span class="STYLE19"> 联系人/经办人座机电话:
				</span></div>
				</td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><input
					class="inputbox validate-passverify" type="text"
					id="contactPersonTelephone" name="contactPersonTelephone" size="40"
					value="{{$company.contactPersonTelephone}}" /></td>
			</tr>
			<tr>
				<td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">配送公司名录: <a
					href="javascript:AddRow()">添加</a> 最多提交20个</span></div></td>
				<td height="20" bgcolor="#FFFFFF" class="STYLE19"><table width="200" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td>配送公司名称</td>
                    <td>配送产品区域</td>
                  </tr>
                  {{section name=d loop=$dispatching}}
                  <tr>
                    <td><input name="dispatching_name[]" value="{{$dispatching[d].name}}" type="text" /></td>
                    <td><input name="dispatching_area[]" value="{{$dispatching[d].area}}" type="text" /></td>
                    <input type="hidden" name="dispatching_id[]" value="{{$dispatching[d].dispatching_id}}" />
                  </tr>
                  {{/section}}
                </table>
                <table width="200" border="0" cellpadding="0" cellspacing="0" id="d_message">

                </table>
                </td>
			</tr>
    <input type="hidden" value="{{$rowse.user_id}}" name="user_id" />
	<input type="hidden" value="{{$rowse.declareperson.id}}" name="declareperson_id" />
	<input type="hidden" value="{{$rowse.declarecompany.declare_id}}" name="declarecompany_id" />
    </table>
	<div style="text-align:center"><input type="submit" value="提交" name="submit" id="submit"/></div>
	</form>
	</td>	
  </tr>
</table>
</body>
</html>
